using System;
using System.Runtime.CompilerServices;

namespace Beetle;

public class NetTcpException : Exception
{
	internal const string a = "<Modulus>{0}<Modulus/>";

	internal const string b = "The message is too long";

	internal const string c = "Cross-border access to data";

	internal const string d = " IPAddress Error!";

	internal const string e = "{0} Type not found!";

	internal const string f = "{0} load data error!";

	internal const string g = "Connection is not available";

	internal const string h = "channel is disposed!";

	internal const string i = "channel receive data timeout!";

	internal const string j = "channel data process error!";

	internal const string k = "channel must be connected";

	internal const string l = "{0} config section not found!";

	internal const string m = "{0} client pool config section not found!";

	internal const int n = 10001;

	internal const int o = 10004;

	internal const int p = 10006;

	[CompilerGenerated]
	private int q;

	public int ErrorNumber
	{
		[CompilerGenerated]
		internal get
		{
			return q;
		}
		[CompilerGenerated]
		set
		{
			q = value;
		}
	}

	public NetTcpException()
	{
	}

	public NetTcpException(string msg)
		: base(msg)
	{
	}

	public NetTcpException(Exception innererr, string msg)
		: base(msg, innererr)
	{
	}

	public static NetTcpException ConfigSelectionNotFound(string name)
	{
		return new NetTcpException($"{name} config section not found!");
	}

	public static NetTcpException ConnectionIsNotAvailable()
	{
		return new NetTcpException("Connection is not available");
	}

	public static NetTcpException ObjectLoadError(string type, Exception innerexception)
	{
		return new NetTcpException(innerexception, $"{type} load data error!");
	}

	public static NetTcpException ReadToByteArraySegment()
	{
		return new NetTcpException("read to ByteArraySegment error!");
	}

	public static NetTcpException ClientDataProcessError(Exception innerexception)
	{
		return new NetTcpException(innerexception, "channel data process error!");
	}

	public static NetTcpException ClientPoolSectionNotFound(string name)
	{
		return new NetTcpException($"{name} client pool config section not found!");
	}

	public static NetTcpException ClientReceiveTimeout()
	{
		return new NetTcpException("channel receive data timeout!");
	}

	public static NetTcpException ClientMustBeConnected()
	{
		return new NetTcpException("channel must be connected");
	}

	public static NetTcpException ClientIsDisposed()
	{
		return new NetTcpException("channel is disposed!");
	}

	public static NetTcpException StringEncodingError(Exception innerexception)
	{
		return new NetTcpException(innerexception, "string encoding error!");
	}

	public static NetTcpException StringDecodingError(Exception innerexception)
	{
		return new NetTcpException(innerexception, "string decoding error!");
	}

	public static NetTcpException NotInitialize()
	{
		return new NetTcpException("Beetle component did not initialize!\r\nCall TcpUtil.Setup!");
	}

	public static NetTcpException PacketAnyalysisNotInitialize()
	{
		return new NetTcpException("Beetle Anyalysis  did not initialize!\r\nCall PacketAnalysis.Setup!");
	}

	public static NetTcpException TypeNotFound(string name)
	{
		return new NetTcpException($"{name} Type not found!");
	}

	public static NetTcpException DataOverflow()
	{
		NetTcpException ex = new NetTcpException("The message is too long");
		ex.ErrorNumber = 10001;
		return ex;
	}

	public static NetTcpException ReadDataError(Exception innererror)
	{
		NetTcpException ex = new NetTcpException(innererror, "Cross-border access to data");
		ex.ErrorNumber = 10004;
		return ex;
	}

	public static NetTcpException IPAddressError()
	{
		NetTcpException ex = new NetTcpException(" IPAddress Error!");
		ex.ErrorNumber = 10006;
		return ex;
	}
}
